<!DOCTYPE html>
<html style="background: #c7c7c7">
<head lang="en">
    <meta charset="UTF-8">
    <meta name='apple-touch-fullscreen' content='yes'>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta content="fullscreen=yes,preventMove=no" name="ML-Config">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no,email=no,address=no" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>我拍中</title>
    <link rel="stylesheet" href="/style/css/style.css"/>
    <script src="/style/js/index.js"></script>
    <script src="/style/js/jQuery.v1.8.3.min.js"></script>
</head>
<style>

.past_time{
	display:none;
	
}
.end_time{
	display:none;
}

</style>
<body>
<header class="head-top">
    <h1>
       <b>我拍中</b><i>！</i>
    </h1>
    <h3>竟购成功</h3>
</header>
<!--<div class="head-time">日期：2018.09.11</div>-->
<div class="head-list" id="vm">
    <ul>


        <?php
          if($this->data)
          {
            foreach ($this->data as $k=>$v){

          ?>
  <li class="settime"  data-time="<?=$v['pay_down_time']?>">
            <a href="checkout?id=<?=$v['id']?>">
                <div style="float:left;width:5rem;display:inline-block">
                     <div class="head-list-top">
                        <h4>
                        <i style="float:left;">商品名称：</i>
                        <b style="display:inline-block;width:3rem;font-weight: normal;"><?=$v['goods_name']?></b>
                          </h4>
                     </div>
                     <div class="head-list-bottom">
                         <h3>
                             成交价 <em>¥ <?=$v['bid_price']?></em>
                         </h3>
                         <i>竟购成功!</i>
                         <div class="bottom-l">
                             <h3 class="go_pay">去付款</h3>
                             <p class="past_time">超时弃权</p>
                         </div>
                     </div>
                </div>
                <div class="right-co">
                    <h3 class="right-no">付款倒计时：<em class="down_time">1</em></h3>
                    <h5 class="end_time" style="display:block">倒计时结束</h5>
                </div>
            </a>
        </li>
            <?php
            }
          }
     ?></ul>
</div>

<script>
$(function(){
	updateEndTime();
	
})
function updateEndTime()
{

var time = <?=$this->time;?>;
$('.end_time').hide();
$(".settime").each(function(i){
	
	 var endTime= $(this).attr('data-time');
    
     var timeShow;
    
    var lag = (endTime - time); //当前时间和结束时间之间的秒数
    if(lag > 0)
    {
    	
      endTime -= 1;
   	 var secondTime = parseInt(lag);// 秒
     var minuteTime = 0;// 分
     var hourTime = 0;// 小时
     if(secondTime > 60) {//如果秒数大于60，将秒数转换成整数
         //获取分钟，除以60取整数，得到整数分钟
         minuteTime = parseInt(secondTime / 60);
         //获取秒数，秒数取佘，得到整数秒数
         secondTime = parseInt(secondTime % 60);
         secondTime = PrefixInteger(secondTime,2);
         
         //如果分钟大于60，将分钟转换成小时
         if(minuteTime > 60) {
             //获取小时，获取分钟除以60，得到整数小时
             hourTime = parseInt(minuteTime / 60);
             hourTime = PrefixInteger(hourTime,2);
             //获取小时后取佘的分，获取分钟除以60取佘的分
             minuteTime = parseInt(minuteTime % 60);
             minuteTime = PrefixInteger(minuteTime,2);
         }
     }
     var result = "" +secondTime;

     if(minuteTime > 0) {
         result = "" + minuteTime + ":" + result;
     }
     if(hourTime > 0) {
         result = "" + hourTime + ":" + result;
     }
    	$(this).attr('data-time',endTime);
       
       /*  var second = Math.floor(lag % 60); 
        var minite = Math.floor((lag / 60) % 60);
        var hour = Math.floor((lag / 3600) % 24);
        timeShow = hour+":"+minite+":"+second; */
       
        $(this).find('.down_time').html(result);
    }
    else
    {
        $(this).removeClass("settime");
        $(this).find('.down_time').hide();
         $(this).find('.right-no').hide();
        $(this).find('.go_pay').hide();
        $(this).find('.end_time').show();
        $(this).find('.past_time').show();
       
    }
});
  setTimeout("updateEndTime()",1000);
}
function PrefixInteger(num, length) {
    return (Array(length).join('0') + num).slice(-length);
}

</script>
</body>
</html>